#!/bin/sh
#PBS -V
#PBS -j oe
#PBS -l nodes=1:ppn=2,mem=10gb,walltime=2400:00:00
#PBS -q batch
#PBS -d /public/home/xxf2019/20210629_colr/results/Qsub_log

Tumor=$1
config_path=$2
Type=$3

source ${config_path}/config.sh

mkdir -p ${Pyclone_path}/result/${Type}/${Tumor}

## 产生输入文件与纯度信息
input_files=""
purity=""

Normal=`cat ${config_path}/tumor_normal.MSI.list | grep -w ${Tumor} | awk -F, '{print $2}'`
Class=`cat ${config_path}/tumor_normal.class.MSI.list | grep -w ${Tumor} | awk '{print $5}'`
purity=`cat ${Titan_path}/Purity_titan.final.reviseLowPurity.tsv | grep -w ${Tumor} | awk -F'\t' '{print $2}'`
input_files=`cat ${config_path}/tumor_normal.class.MSI.list | grep -w ${Tumor} | awk '{print inputPath"/"$5".tsv"}' inputPath=${Pyclone_path}/Input_all/${Normal}`

${PyClone} run_analysis_pipeline --in_files ${input_files} \
--working_dir ${Pyclone_path}/result/${Type}/${Tumor} \
--prior parental_copy_number \
--tumour_contents ${purity} \
--density pyclone_beta_binomial \
--burnin 1000 \
--max_clusters 100 \
--num_iters 10000 \
2> ${log_path}/${Tumor}_pyclone.log